package vip.liux.contracts.shared.enums.pay;

import vip.liux.core.enums.IEnum;

import java.util.Objects;

public enum PayRefundStatus implements IEnum {

    WAITING(0, "未退款"),
    SUCCESS(1, "退款成功"),
    FAILURE(2, "退款失败");

    /**
     * 类型
     */
    private final int value;
    /**
     * 名字
     */
    private final String desc;

    PayRefundStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static boolean isSuccess(Integer status) {
        return Objects.equals(status, SUCCESS.getValue());
    }

    public static boolean isSuccess(PayRefundStatus status) {
        return Objects.equals(status, SUCCESS);
    }

    public static boolean isFailure(Integer status) {
        return Objects.equals(status, FAILURE.getValue());
    }

    public static boolean isFailure(PayRefundStatus status) {
        return Objects.equals(status, FAILURE);
    }

    @Override
    public int getValue() {
        return value;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
